

********************************************************************************
* Table 1: Yield Changes Within vs. Outside the 3-day FOMC Window
********************************************************************************

use "../data/final_data_fed_secular_decline", clear

keep if date >= mdy(6,1,1989)
drop if date >= mdy(7,1,2021)

*Define 3-day FOMC window
generate fomc = 1 if !missing(fomc_meet[_n+1]) | !missing(fomc_meet) | !missing(fomc_meet[_n-1])
replace fomc = 0 if missing(fomc)

*Eliminate stale pricing
local yield_bbg_list "usgg10_chg usgg30_chg usgg5_chg gtii10_chg gtii30_chg"
foreach x of local yield_bbg_list {
	count if `x' == 0
	replace `x' = . if `x' == 0
}

*Convert yields to basis points
ds *chg
foreach x in `r(varlist)' {
	replace `x' = `x' * 100
}

*Labels
label var sveny01_chg 	"1y Treasury yield (GSW)"
label var sveny02_chg 	"2y Treasury yield (GSW)"
label var sveny05_chg 	"5y Treasury yield (GSW)"
label var usgg5_chg 	"5y on-the-run Treasury yield (BB)"
label var svenf05_chg	"5y inst. forward rate (GSW)"
label var fwd5y5y_chg 	"5y5y Treasury forward rate (GSW)"
label var svenf09_chg	"9y inst. forward rate (GSW)"
label var sveny10_chg 	"10y Treasury yield (GSW)"
label var usgg10_chg 	"10y on-the-run Treasury yield (BB)"
label var sveny30_chg 	"30y Treasury yield (GSW)"
label var usgg30_chg 	"30y on-the-run Treasury yield (BB)"
label var tipsy10_chg 	"10y TIPS yield (GSW)"
label var gtii10_chg 	"10y on-the-run TIPS yield (BB)"
label var bkeven10_chg 	"10y Breakeven yield (GSW)"
label var usswit10_chg 	"10y Inflation swaps (BB)"
label var tipsy20_chg 	"20y TIPS yield (GSW)"
label var gtii30_chg 	"30y on-the-run TIPS yield (BB)"

*FOMC-window
preserve 
	keep if fomc == 1
	
	*Treasury yield changes since June 1989
	eststo clear
	eststo a1: regress sveny01_chg, vce(hc2)
	eststo a2: regress sveny02_chg, vce(hc2)
	eststo a3: regress sveny05_chg, vce(hc2)
	eststo a4: regress usgg5_chg, vce(hc2)
	eststo a5: regress svenf05_chg, vce(hc2)
	eststo a6: regress fwd5y5y_chg, vce(hc2)
	eststo a7: regress svenf09_chg, vce(hc2)
	eststo a8: regress sveny10_chg, vce(hc2)
	eststo a9: regress usgg10_chg, vce(hc2)
	eststo a10: regress sveny30_chg, vce(hc2)
	eststo a11: regress usgg30_chg, vce(hc2)
	esttab, label nonotes b(%8.2f) sfmt(%8.2f) starlevels(* 0.10 ** 0.05 *** 0.01) 

	*Treasury, TIPS, inflation since 1997 (or later)
	eststo a12: regress sveny10_chg if !missing(tipsy10_chg), vce(hc2)
	estadd local sample "Jan 1999"
	eststo a13: regress tipsy10_chg, vce(hc2)
	estadd local sample "Jan 1999"
	eststo a14: regress gtii10_chg, vce(hc2)
	estadd local sample "Feb 1997"
	eststo a15: regress bkeven10_chg, vce(hc2)
	estadd local sample "Jan 1999"
	eststo a16: regress usswit10_chg, vce(hc2)
	estadd local sample "Jul 2004"
	eststo a17: regress tipsy20_chg, vce(hc2)
	estadd local sample "Jan 1999"
	eststo a18: regress gtii30_chg, vce(hc2)
	estadd local sample "Apr 1998"
	esttab a12 a13 a14 a15 a16 a17 a18, label nonotes b(%8.2f) sfmt(%8.2f) starlevels(* 0.10 ** 0.05 *** 0.01)
restore

esttab a* using "../tables/table1_parta.csv", replace label nonotes b(%8.2f) sfmt(%8.2f) scalars("sample Start date") starlevels(* 0.10 ** 0.05 *** 0.01) 

*Outside of FOMC window
preserve 
	keep if fomc == 0
	
	*Treasury yield changes since June 1989	
	eststo clear
	eststo a1: regress sveny01_chg, vce(hc2)
	eststo a2: regress sveny02_chg, vce(hc2)
	eststo a3: regress sveny05_chg, vce(hc2)
	eststo a4: regress usgg5_chg, vce(hc2)
	eststo a5: regress svenf05_chg, vce(hc2)
	eststo a6: regress fwd5y5y_chg, vce(hc2)
	eststo a7: regress svenf09_chg, vce(hc2)
	eststo a8: regress sveny10_chg, vce(hc2)
	eststo a9: regress usgg10_chg, vce(hc2)
	eststo a10: regress sveny30_chg, vce(hc2)
	eststo a11: regress usgg30_chg, vce(hc2)
	esttab, label nonotes b(%8.2f) sfmt(%8.2f) starlevels(* 0.10 ** 0.05 *** 0.01) 

	*Treasury, TIPS, inflation since 1997 (or later)
	eststo a12: regress sveny10_chg if !missing(tipsy10_chg), vce(hc2)
	estadd local sample "Jan 1999"
	eststo a13: regress tipsy10_chg, vce(hc2)
	estadd local sample "Jan 1999"
	eststo a14: regress gtii10_chg, vce(hc2)
	estadd local sample "Feb 1997"
	eststo a15: regress bkeven10_chg, vce(hc2)
	estadd local sample "Jan 1999"
	eststo a16: regress usswit10_chg, vce(hc2)
	estadd local sample "Jul 2004"
	eststo a17: regress tipsy20_chg, vce(hc2)
	estadd local sample "Jan 1999"
	eststo a18: regress gtii30_chg, vce(hc2)
	estadd local sample "Apr 1998"
	esttab a12 a13 a14 a15 a16 a17 a18, label nonotes b(%8.2f) sfmt(%8.2f) starlevels(* 0.10 ** 0.05 *** 0.01)
restore

esttab a* using "../tables/table1_partb.csv", replace label nonotes b(%8.2f) sfmt(%8.2f) scalars("sample Start date") starlevels(* 0.10 ** 0.05 *** 0.01) 

*To get the .csv into Latex tables:
*1) Transpose in excel 
*2) Copy into website: https://tableconvert.com/excel-to-latex to convert to latex table
